<?php 
/**
 * ... ...
 * ... ...
 *
 */ 



// 载入父 类 
//<<[UnmodifiableBlock.Start]::Include Parent Class::>>//
JCAT_Package::ImportClass('JCAT_UIGtkCtrlTree',JCAT::PACKAGE_UICTRLGTK) ;
//<<[UnmodifiableBlock.End]::Include Parent Class::>>//

// 载入所需的 数据校验器 类 
//<<[UnmodifiableBlock.Start]::Include Data Verifier Class::>>//

//<<[UnmodifiableBlock.End]::Include Data Verifier Class::>>//

/**
 * JCAT_UIGtkCtrlTree 类型UI控件 TreeDBTableLink 
 * 
 * @access	public
 * @author	由 JeCat PHP Toolbox 产生 
 */
class TreeDBTableLink 
	//<<[UnmodifiableBlock.Start]::Extends::>>//
	extends JCAT_UIGtkCtrlTree 
	//<<[UnmodifiableBlock.End]::Extends::>>//
{
	/**
	 * TreeDBTableLink类 的 构造函数 
	 * 
	 * @access	public
	 * @return	void
	 */
	public function TreeDBTableLink()
	{
		// 初始化 父类 
		//<<[UnmodifiableBlock.Start]::Init Parent Class::>>//
		$this->JCAT_UIGtkCtrlTree(__CLASS__,JCAT_Language::Sentence("*"),'TreeDBTableLink') ; 
		//<<[UnmodifiableBlock.End]::Init Parent Class::>>//

		// 创建并载入 数据校验器 
		//<<[UnmodifiableBlock.Start]::Data Verifier::>>//

		//<<[UnmodifiableBlock.End]::Data Verifier::>>//


		// 在此添加 初始化 代码 
		// TODO ... ...
		$this->aGroupLogicModel = new GtkTreeStore(Gtk::TYPE_STRING) ;
		$this->aGroupLogicModel->append(null,array(SQLGROUP_TEXT_LOGIC_AND)) ;
		$this->aGroupLogicModel->append(null,array(SQLGROUP_TEXT_LOGIC_OR)) ;
		
		$this->aEmptyModel = new GtkTreeStore(Gtk::TYPE_STRING) ;
	}
	
	/**
	 * 创建一个  GtkTreeModel 模型  
	 * 
	 * @access	public
	 * @return	void
	 */
	public function CreateModel()
	{
		//<<[UnmodifiableBlock.Start]::Create Model::>>//
		$aModel = new GtkTreeStore(
			Gtk::TYPE_STRING
			, Gtk::TYPE_STRING
			, Gtk::TYPE_STRING
			, Gtk::TYPE_STRING
			, Gtk::TYPE_STRING
			, Gtk::TYPE_STRING
			) ;
		//<<[UnmodifiableBlock.End]::Create Model::>>//
		
		// 在此添加代码  
		// TODO ... ...
		
		return $aModel ;
	}
	
	/**
	 * 初始化  GtkTreeView 的列  
	 * 
	 * @access	public
	 * @return	void
	 */
	public function InitializeColumns()
	{
		// 取得视图 
		$wndTreeView = $this->GetMainWidget() ;
		JCAT_ASSERT::ASSERT_INSTANCE($wndTreeView,'GtkTreeView',
					JCAT_Language::SentenceEx('UI控件“%”的主窗体尚未创建，在正常情况下  InitializeColumns()不应该被直接调用，UI控件的主窗体在创建之时，会自动调用此方法。','JCAT',null,$this->GetName())) ;

		// 设置 视图上的 各列 
		//<<[UnmodifiableBlock.Start]::Setting Columns::>>//
		// 视图列：表达式
		$aRenderForColumn0 = new GtkCellRendererCombo() ;
		$aRenderForColumn0->set_property('has-entry',false) ;
		$aRenderForColumn0->set_property('editable',true) ;
		$aRenderForColumn0->connect('edited',array($this,'OnTextEdit'),self::CLM_EXPRESSION) ;
		$wndColumn0 = new GtkTreeViewColumn(JCAT_Language::Sentence('表达式'),$aRenderForColumn0,'text',self::CLM_EXPRESSION) ;
		$wndTreeView->append_column($wndColumn0) ;

		// 视图列：类型
		$aRenderForColumn1 = new GtkCellRendererText() ;
		$aRenderForColumn1->set_property('editable',false) ;
		$wndColumn1 = new GtkTreeViewColumn(JCAT_Language::Sentence('类型'),$aRenderForColumn1,'text',self::CLM_TYPE) ;
		$wndColumn1->set_visible(false) ;
		$wndTreeView->append_column($wndColumn1) ;

		// 视图列：左边
		$aRenderForColumn2 = new GtkCellRendererText() ;
		$aRenderForColumn2->set_property('editable',false) ;
		$wndColumn2 = new GtkTreeViewColumn(JCAT_Language::Sentence('左边'),$aRenderForColumn2,'text',self::CLM_LEFT) ;
		$wndColumn2->set_visible(false) ;
		$wndTreeView->append_column($wndColumn2) ;

		// 视图列：操作符
		$aRenderForColumn3 = new GtkCellRendererText() ;
		$aRenderForColumn3->set_property('editable',false) ;
		$wndColumn3 = new GtkTreeViewColumn(JCAT_Language::Sentence('操作符'),$aRenderForColumn3,'text',self::CLM_OPERATOR) ;
		$wndColumn3->set_visible(false) ;
		$wndTreeView->append_column($wndColumn3) ;

		// 视图列：右边
		$aRenderForColumn4 = new GtkCellRendererText() ;
		$aRenderForColumn4->set_property('editable',false) ;
		$wndColumn4 = new GtkTreeViewColumn(JCAT_Language::Sentence('右边'),$aRenderForColumn4,'text',self::CLM_RIGHT) ;
		$wndColumn4->set_visible(false) ;
		$wndTreeView->append_column($wndColumn4) ;

		// 视图列：右边B
		$aRenderForColumn5 = new GtkCellRendererText() ;
		$aRenderForColumn5->set_property('editable',false) ;
		$wndColumn5 = new GtkTreeViewColumn(JCAT_Language::Sentence('右边B'),$aRenderForColumn5,'text',self::CLM_RIGHT_B) ;
		$wndColumn5->set_visible(false) ;
		$wndTreeView->append_column($wndColumn5) ;
		//<<[UnmodifiableBlock.End]::Setting Columns::>>//
		

		// 在此添加 代码 
		// TODO ... ...
		$aRenderer = $this->GetCellRender(self::CLM_EXPRESSION) ;
		$aRenderer->set_property('text-column',0) ;
			
		$aColumn = $this->GetColumn(self::CLM_EXPRESSION) ;
		$aColumn->set_cell_data_func($aRenderer,array($this,'OnRenderColumnExpression')) ;
	}

	
	/**
	 * what's this
	 * 
	 * @access	public
	 * @return	void
	 */
	public function OnRenderColumnExpression(GtkCellLayout $aColumn, GtkCellRenderer $aRenderer, GtkTreeModel $aModel, GtkTreeIter $aItem)
	{		
		$nType = $this->GetCellData($aItem,self::CLM_TYPE) ;
		if( $nType==self::TYPE_GROUP )
		{
			$aRenderer->set_property('model',$this->aGroupLogicModel) ;
			$aRenderer->set_property('has-entry',false) ;
		
		}
		
		else
		{
			$aRenderer->set_property('model',$this->aEmptyModel) ;
			$aRenderer->set_property('has-entry',true) ;
		}
	}
	
	// 为 视图的列 定义常量 
	//<<[UnmodifiableBlock.Start]::Define Column Consts::>>//
	const CLM_EXPRESSION = 0 ;
	const CLM_TYPE = 1 ;
	const CLM_LEFT = 2 ;
	const CLM_OPERATOR = 3 ;
	const CLM_RIGHT = 4 ;
	const CLM_RIGHT_B = 5 ;
	//<<[UnmodifiableBlock.End]::Define Column Consts::>>//

	
	const TYPE_LINK = 1 ;
	const TYPE_GROUP = 2 ;
	const TYPE_EXPRESSION = 3 ;

	
	/**
	 * 
	 * 
	 * @access	private
	 * @var		GtkCellRendererText
	 */
	private $aEmptyModel ;
	
	/**
	 * 
	 * 
	 * @access	private
	 * @var		GtkCellRendererText
	 */
	private $aGroupLogicModel ;
}






?><?
/**
 * [注意!!]
 *	以下内容由 JCAT PHP Toolbox 自动维护，手动更改的内容会被 JCAT PHP Toolbox 抹除，
 *	同时还可能破坏格式，导致 JCAT PHP Toolbox 无法正常读取。
 */
/*<<[UnmodifiableBlock.Start]::Coder Dialog Data::>>&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//
<<{{DocumentClass:UICtrlGtkTreeDoc}}>>
eCVEQSVBNSU5NEslOEYlRDJQJTE0JUM3JUY3JTI2JTdFJTg4JUU5JUQyJUM0JUU5JTgzJUU3JURDTiUyNiU4MUthJUNBJUYwJTI4JUE1RSU1RCU5MSUwQiU1QyVBNSVGNEUlREElOEUlNDBIJTNGJTgxMSVCM3BrTCVEQ0wlNUMlQjgxLiU4Q1ElRjk0JUUyJUYwMSVCQyU5N0slMDklMUF0SFglREMlQTQlQkQlRTclRjUl
M0IlRkYlRjYlMUMlMDQlMjQwJTBGQSUxQXAlMjUlMTQlMjFORitHJURGJUM1MyVDMCU5OSUyQSU4QyUwMkd1JUM3JTBFdiVCMSUxNyUx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